/* 微信接口对话界面样式 - 类似 Cursor.com 风格 */

.chat-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chat-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-10px) translateY(-10px); }
}

.chat-container {
    position: relative;
    z-index: 10;
    max-width: 900px;
    width: 95%;
    padding: 0 20px;
}

.chat-title {
    text-align: center;
    margin-bottom: 40px;
}

.chat-title h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.2;
}

.chat-title p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    font-weight: 300;
}

.chat-interface {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.chat-watermark {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 70px;
    font-size: 0.95rem;
    color: rgba(108, 117, 125, 0.5);
    pointer-events: none;
    white-space: normal;
    z-index: 3;
    font-weight: 400;
    letter-spacing: 0.2px;
    text-align: left;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: opacity 0.3s ease;
    opacity: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-watermark.hidden {
    opacity: 0;
}

.chat-input-container {
    position: relative;
    z-index: 2;
}

.chat-input {
    width: 100%;
    min-height: 120px;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 20px 60px 20px 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.chat-input::placeholder {
    color: transparent;
}

.chat-submit-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.chat-submit-btn:active {
    transform: translateY(0);
}

.chat-submit-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.3);
}

.chat-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.chat-submit-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.chat-features {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* 当功能卡片隐藏时，调整对话框样式 */
.chat-interface:not(:has(.chat-features:not([style*="display: none"]))) {
    margin-bottom: 0;
}

.chat-feature {
    text-align: center;
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.chat-feature:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.chat-feature-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-feature-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
    stroke: white;
    stroke-width: 1.5px;
}

.chat-feature h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.chat-feature p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-hero {
        min-height: 100vh;
        padding: 20px 0;
    }
    
    .chat-container {
        width: 98%;
        padding: 0 10px;
    }
    
    .chat-title h1 {
        font-size: 2.5rem;
    }
    
    .chat-title p {
        font-size: 1.1rem;
    }
    
    .chat-interface {
        padding: 25px 15px;
        border-radius: 20px;
    }
    
    .chat-watermark {
        top: 18px;
        left: 15px;
        right: 65px;
        font-size: 0.9rem;
    }
    
    .chat-input {
        padding: 18px 55px 18px 15px;
        font-size: 0.9rem;
    }
    
    .chat-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chat-feature {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: 100%;
        padding: 0 5px;
    }
    
    .chat-title h1 {
        font-size: 2rem;
    }
    
    .chat-interface {
        padding: 20px 12px;
        border-radius: 16px;
    }
    
    .chat-watermark {
        top: 16px;
        left: 12px;
        right: 60px;
        font-size: 0.85rem;
    }
    
    .chat-input {
        padding: 16px 50px 16px 12px;
        min-height: 100px;
        font-size: 0.85rem;
    }
}

/* 动画效果 */
.chat-interface {
    animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-feature {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.chat-feature:nth-child(1) { animation-delay: 0.1s; }
.chat-feature:nth-child(2) { animation-delay: 0.2s; }
.chat-feature:nth-child(3) { animation-delay: 0.3s; }
.chat-feature:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载状态 */
.chat-loading {
    display: none;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.chat-loading.active {
    display: flex;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* AI 回复样式 */
.ai-response-container {
    margin-top: 30px;
    max-width: 900px;
    width: 95%;
    margin-left: auto;
    margin-right: auto;
}

.response-item {
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease-out;
}

.ai-response {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.response-header {
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.response-header h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.query-info {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-query-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #667eea;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.edit-query-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #764ba2;
}

.edit-query-btn svg {
    display: block;
}

.user-query {
    color: #667eea;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.response-content > div {
    margin-bottom: 25px;
}

.response-content h4 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.module-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.description-section p {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 15px;
}

.description-section ul {
    color: #6c757d;
    padding-left: 20px;
}

.description-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.code-tabs {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
}

.tab-buttons {
    background: #f8f9fa;
    display: flex;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    border-right: 1px solid #dee2e6;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-btn:hover:not(.active) {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane pre {
    margin: 0;
    padding: 20px;
    background: #2d3748;
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    overflow-x: auto;
}

.tab-pane code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* 参数表格样式 */
.parameter-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #e2e8f0 !important;
}

.parameter-table * {
    color: #e2e8f0 !important;
}

.parameter-table th,
.parameter-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid #4a5568;
}

.parameter-table th {
    background: #3c4758;
    font-weight: 600;
    color: #a0aec0;
}

.parameter-table tr {
    background: #2d3748;
}

.parameter-table tr:nth-child(even) {
    background: #323b4c;
}

.parameter-table tr:hover {
    background: #3c4758;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .parameter-table {
        font-size: 0.8rem;
    }
    
    .parameter-table th,
    .parameter-table td {
        padding: 8px;
    }
}

.tips-section {
    background: rgba(102, 126, 234, 0.05);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.tip-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 10px;
}

.tip-item ul {
    margin: 0;
    padding-left: 20px;
}

.tip-item li {
    color: #495057;
    margin-bottom: 6px;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-response {
        padding: 20px;
        margin: 0 10px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .tab-pane pre {
        padding: 15px;
        font-size: 0.8rem;
    }
    
    .module-info {
        gap: 8px;
    }
    
    .module-tag {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .ai-response-container {
        width: 100%;
        padding: 0 5px;
    }
    
    .ai-response {
        padding: 15px;
        margin: 0;
    }
    
    .response-header h3 {
        font-size: 1.2rem;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .tab-btn:last-child {
        border-bottom: none;
    }
}

/* 返回首页链接样式 */
.back-to-home {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    margin-top: 50px;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* AiDoc页面专用样式 */
.aidoc-page .chat-hero {
    min-height: 60vh;
}

.aidoc-page .chat-title h1 {
    font-size: 3rem;
}

@media (max-width: 768px) {
    .aidoc-page .chat-title h1 {
        font-size: 2.2rem;
    }
}
